import request from '@/router/axios';

export const getList = (current, size, params) => {
    return request({
        url: '/api/mes-warehouse/scm/delivery-sheet/page-query',
        method: 'get',
        params: {
            ...params,
            current,
            size
        }
    })
}

export const submitDeliveryOrder = (data) => {
    return request({
        url: '/api/mes-warehouse/scm/delivery-sheet/submit',
        method: 'post',
        data: data
    })
}

export const getDetail = (scmDeliveryOrderId) => {
    return request({
        url: '/api/mes-warehouse/scm/delivery-sheet/detail',
        method: 'get',
        params: {
            scmDeliveryOrderId
        }
    })
}

export const queryDeliveryOrderDetail = (current, size, params) => {
    return request({
        url: '/api/mes-warehouse/scm/delivery-sheet/page-query-detail',
        method: 'get',
        params: {
            ...params,
            current,
            size
        }
    })
}

export const removeDeliveryOrder = (ids) => {
    return request({
        url: '/api/mes-warehouse/scm/delivery-sheet/remove',
        method: 'get',
        params: {
            ids
        }
    })
}

export const deliveryPreviewStatistic = (scmDeliveryOrderId) => {
    return request({
        url: '/api/mes-warehouse/scm/delivery-sheet/deliver-preview-statistic',
        method: 'get',
        params: {
            scmDeliveryOrderId
        }
    })
}

export const getVendorInfo = (scmDeliveryOrderId) => {
    return request({
        url: '/api/mes-warehouse/scm/delivery-sheet/get-vendor-info-by-sheet-id',
        method: 'get',
        params: {
            scmDeliveryOrderId
        }
    })
}

export const getVendorDetail = (id) => {
    return request({
        url: '/api/mes-admin/partner/detail',
        method: 'get',
        params: {
            id
        }
    })
}

export const getDeliveryPreviewInfo = (scmDeliveryOrderIds) => {
    return request({
        url: '/api/mes-warehouse/scm/delivery-sheet/deliver-preview',
        method: 'get',
        params: {
            scmDeliveryOrderIds
        }
    })
}

export const getPreviewBarCode = (data) => {
    return request({
        url: '/api/mes-warehouse/scm/sequence/preview',
        method: 'post',
        data: data
    })
}

export const getCreateBarCode = (data) => {
    return request({
        url: '/api/mes-warehouse/scm/sequence/create',
        method: 'post',
        data: data
    })
}

export const sequencePirnt = (data) => {
    return request({
        url: '/api/mes-warehouse/scm/sequence/print',
        method: 'post',
        data: data
    })
}

export const sequenceScrap = (deliverySheetItemId) => {
    return request({
        url: `/api/mes-warehouse/scm/sequence/scrap?deliverySheetItemId=${deliverySheetItemId}`,
        method: 'post'
    })
}

export const getSequenceDetail = (deliverySheetItemId) => {
    return request({
        url: '/api/mes-warehouse/scm/sequence/sequence-detail',
        method: 'get',
        params: {
            deliverySheetItemId
        }
    })
}

export const delivering = (data) => {
    return request({
        url: '/api/mes-warehouse/scm/delivery-sheet/delivering',
        method: 'post',
        data: data
    })
}

export const deliveryOrderPrint = (scmDeliveryOrderId) => {
    return request({
        url: `/api/mes-warehouse/scm/delivery-sheet/print-deliver-sheet?scmDeliveryOrderId=${scmDeliveryOrderId}`,
        method: 'post'
    })
}